package staticTest;

import java.util.ArrayList;

/**
 * @Author 28021
 * @Date 2022/10/11
 */
public class ArrayUtil {
    //私有化构造方法，为了不让外部构造它的对象
    private ArrayUtil(){

    }
    public static String printArr(int[] arr){
        ArrayList<Integer> arr1 = new ArrayList<>();
        for (int i = 0; i < arr.length; i++) {
            arr1.add(arr[i]);
        }

//        String x=arr1.toString();
//        return x;
        return arr1.toString();
    }

    public static double getAverage(double[] arr){
        double sum = 0;
        for (int i = 0; i < arr.length; i++) {
            sum += arr[i];
        }
        double avr = sum/arr.length;
        return avr;

    }
}
